<?php

class BooktypeController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        // action body
        $this->view->headTitle("Quản lý thể loại sách");
        if($ajaxAction = $this->_request->getParam("ajax_action")){
            $model = new Application_Model_DbTable_TheLoaiSach();
            $result = $model->$ajaxAction($this->_request->getParam("sdata"));
            return $this->_helper->json->sendJson($result);
        }
    }

    public function listAction()
    {
        // action body
        // action body
        $this->_helper->layout()->disableLayout();
        $model = new Application_Model_DbTable_TheLoaiSach();
        $select = $model->getDataTable(); 
        
        $adapter = new Zend_Paginator_Adapter_DbTableSelect( $select );
        $datas = new Zend_Paginator( $adapter );
        $page = $this->_request->getParam("page",1);
        $datas->setCurrentPageNumber($page);
        $datas->setItemCountPerPage(15);
        $this->view->datas = $datas;
    }


}



